@extends('layouts.admin')
@section('title')
    网站管理
@endsection
@section('content')
    <div>
        {{-- navbar--}}
        <div>
            <a class="btn btn-info" href="{{route('site.site.create')}}">
                <i class="fa fa-plus" aria-hidden="true">添加网站</i>
            </a>
            @if(user()->isSuperAdmin)
                <i class="fa fa-info-circle" aria-hidden="true"></i>
                <span>您是超级管理员</span>
            @endif

        </div>
        {{--    end-navbar--}}
        @foreach($sites as $site)
            <div class="card shadow-sm mb-3">
                <div class="card-header d-flex justify-content-between align-items-center">

                    <div>
                        套餐:
                        @foreach($site->master->group->packages as $package)
                            <span class="badge badge-info">{{$package['title']}}</span>
                        @endforeach
                    </div>

                    <a href="{{route('site.module.index',$site)}}">
                        <i class="fa fa-cog" aria-hidden="true"></i>应用扩展
                    </a>
                </div>
                <div class="card-body">
                    <i class="fa fa-rss fa-3x mr-3" aria-hidden="true"></i>
                    <a href="{{route('site.module.index',$site)}}" class="h3">{{$site['title']}}</a>
                </div>
                <div class="card-footer text-muted d-flex flex-column flex-lg-row justify-content-between">
                    <div>
                        #{{$site['id']}}
                        创建时间:{{$site['create_at']}}
                        站长:{{$site->master->name}}
                        所属组:{{$site->master->group->title}}
                        @if($site->module->title??'')
                            默认模块:{{$site->module->title}}
                        @endif

                    </div>
                    <div class="small mb-2">
                        @if($site['domain'])
                            <a href="{{$site['domain']}}" target='_blank' class="text-muted mr-2"><i aria-hidden="true"
                                                                                                     class="fa fa-home"></i>访问首页</a>
                        @endif

                        @can('update',$site)
                            <a href="{{route('site.config.edit',$site)}}" class="text-muted mr-2"><i aria-hidden="true"
                                                                                                     class="fa fa-home"></i>网站配置</a>
                            <a href="{{route('wechat.wechat.index',$site)}}" class="text-muted mr-2"><i
                                    aria-hidden="true"
                                    class="fa fa-home"></i>微信公众号</a>
                            <a href="{{route('site.admin.index',['site'=>$site])}}" class="text-muted mr-2"><i
                                    aria-hidden="true"
                                    class="fa fa-home"></i>管理员设置</a>

                            <a href="{{route('site.role.index',$site)}}" class="text-muted mr-2"><i aria-hidden="true"
                                                                                                    class="fa fa-home"></i>角色管理</a>
                            <a href="{{route('site.site.edit',$site)}}" class="text-muted mr-2"><i aria-hidden="true"
                                                                                                   class="fa fa-home"></i>编辑</a>
                            <btn-del class="text-muted mr-2" class-name=""
                                     action="{{route('site.site.destroy',$site)}}"><i
                                    aria-hidden="true" class="fa fa-home"></i>删除
                            </btn-del>
                        @endcan

                    </div>
                </div>

            </div>
        @endforeach


    </div>
@endsection
